<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="org.jawa.Constants,org.jawa.util.ParamUtils,
	java.util.HashMap,
	java.util.Locale,
	java.util.Map,
	java.util.StringTokenizer,
	org.jawa.Constants,org.jawa.util.ParamUtils,
	org.jawa.util.ClassUtils,
	org.jawa.database.*,
	java.io.File,
	java.sql.*,
	java.util.HashMap,
	java.util.Locale,
	java.util.Map,
	java.util.StringTokenizer"
%>
<%! // Global vars
	static final String DBCP = "dbcp";
	static final String PROXOOL = "proxool";
%>
<%
	String mode = ParamUtils.getParameter(request,"datasourceType");
	boolean next = ParamUtils.getBooleanParameter(request,"next");
	
	// handle a mode redirect
	Map<String,String> errors = new HashMap<String,String>();
	if (next) {
	    if (DBCP.equals(mode)) {
	    	Constants.setXMLProperty("connectionProvider.className",
            "org.jawa.database.DefaultConnectionProvider");	
	    	response.sendRedirect("setup-datasource-standard-settings.jsp?datasourceType="+mode);
	        return;
	    }
	    else if (PROXOOL.equals(mode)) {
	        // Set the classname of the provider in the config file:
	        Constants.setXMLProperty("connectionProvider.className",
	                "org.jawa.database.ProxoolConnectionProvider");	        
	    	response.sendRedirect("setup-datasource-standard-settings.jsp?datasourceType="+mode);
	        return;
	    }
	}
%>
<html>
<head>
<title><fmt:message key="setup.datasource.setting.title" /></title>
<meta name="currentStep" content="3"/>
</head>
<body>
	<h1>
       <fmt:message key="setup.datasource.connection.title" />
	</h1>
	<p>
	    <fmt:message key="setup.datasource.connection.info"/>
	</p>

	<!-- BEGIN jawa-contentBox -->
	<div class="jawa-contentBox">
	<form action="setup-datasource-standard-select.jsp">
		<input type="hidden" name="next" value="true">

		<table cellpadding="3" cellspacing="2" border="0">
			<tr>
				<td align="center" valign="top">
					<input type="radio" name="datasourceType" value="<%= PROXOOL %>" id="rb02"
         				<%= ((PROXOOL.equals(mode)) ? "checked" : "") %>>
				</td>
				<td>
					<label for="rb02">
						<b>
							<fmt:message key="setup.datasource.proxool.connect" />
						</b>
					</label>
					<br>
					<fmt:message key="setup.datasource.proxool.connect_info" />
				</td>
			</tr>
			
			<tr>
				<td align="center" valign="top">
					<input type="radio" name="datasourceType" value="<%= DBCP %>" id="rb01"
         				<%= ((DBCP.equals(mode)) ? "checked" : "") %>>
				</td>
				<td>
					<label for="rb01"><b>
						<fmt:message key="setup.datasource.dbcp.connect" /></b>
					</label>
					<br>
					<fmt:message key="setup.datasource.dbcp.connect_info" />
				</td>
			</tr>
		</table>
		<br>
		<br>
		<div align="right">
			<input type="Submit"
				value="<fmt:message key="button.continue" />" id="jawa-setup-save"	border="0">
		</div>
	</form>
</div>
	<!-- END jawa-contentBox -->
</body>
</html>
